# -*- coding: utf-8 -*-
# !/usr/bin/env python3
# Author: eddyhhu(胡皓)
import logging

"""
logging configuration.
"""
import logging
from logging.handlers import TimedRotatingFileHandler
from configs import config


def config_log(filename: str, level: int):
    """Log configuration """
    time_file_handler = TimedRotatingFileHandler(
        filename,
        **config.log_config
        # when='D',  # 日志切分的间隔时间单位
        # interval=1,  # 间隔时间单位的个数
        # backupCount=10  # 保留日志的文件个数
    )
    logging.basicConfig(level=level, handlers=[
        time_file_handler], format=config.LOG_FORMAT)
